import { createRouter, createWebHistory } from 'vue-router'

import Home from '@/views/Home.vue'
import Login from '@/views/Login.vue'
import Axios from '@/views/Axios.vue'
import NotFound from '@/views/404.vue'

const routes = [
  {
    path: '/404',
    name: '404',
    component: NotFound
  },
  {
    path: '/home',
    name: 'home',
    component: Home
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    name: 'default',
    component: Home
  },
  {
    path: '/axios',
    name: 'axios',
    component: Axios
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '404',
    name: 'any'
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routes,
  scrollBehavior() {
    return { top: 0, left: 0 }
  }
})

export default router
